package com.francis.spring.mvcframework.action;

import com.francis.spring.mvcframework.annotation.FrancisAutowired;
import com.francis.spring.mvcframework.annotation.FrancisController;
import com.francis.spring.mvcframework.annotation.FrancisRequestMapping;
import com.francis.spring.mvcframework.annotation.FrancisRequestParam;
import com.francis.spring.mvcframework.service.ITestService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author Francis
 * @Date 2020/10/19 0:12
 * @Version 1.0
 */
@FrancisController
@FrancisRequestMapping("/francis")
public class TestAction {
    @FrancisAutowired
    private ITestService testService;

    @FrancisRequestMapping("/query")
    public void query(HttpServletRequest req, HttpServletResponse resp,
                      @FrancisRequestParam("name") String name){
        String result = testService.get(name);
        try {
            resp.getWriter().write(result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
